Clover coverage report - Enterprise Web Services - 1.0
Coverage timestamp: Mon May 30 2005 17:10:32 CEST
file stats: LOC: 226   Methods: 15
NCLOC: 132   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
JaxRpcMapperImpl.java 38.9% 50.8% 53.3% 47.3%
coverage coverage
 1   
 /*
 2   
  * Copyright 2001-2004 The Apache Software Foundation.
 3   
  * 
 4   
  * Licensed under the Apache License, Version 2.0 (the "License");
 5   
  * you may not use this file except in compliance with the License.
 6   
  * You may obtain a copy of the License at
 7   
  * 
 8   
  *      http://www.apache.org/licenses/LICENSE-2.0
 9   
  * 
 10   
  * Unless required by applicable law or agreed to in writing, software
 11   
  * distributed under the License is distributed on an "AS IS" BASIS,
 12   
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13   
  * See the License for the specific language governing permissions and
 14   
  * limitations under the License.
 15   
  */
 16   
 
 17   
 package org.apache.geronimo.ews.ws4j2ee.context.impl;
 18   
 
 19   
 import org.apache.axis.wsdl.symbolTable.BindingEntry;
 20   
 import org.apache.axis.wsdl.symbolTable.PortTypeEntry;
 21   
 import org.apache.axis.wsdl.symbolTable.ServiceEntry;
 22   
 import org.apache.geronimo.ews.jaxrpcmapping.J2eeEmitter;
 23   
 import org.apache.geronimo.ews.jaxrpcmapping.JaxRpcMapper;
 24   
 import org.apache.geronimo.ews.ws4j2ee.context.JaxRpcMapperContext;
 25   
 import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
 26   
 import org.apache.geronimo.ews.ws4j2ee.toWs.UnrecoverableGenerationFault;
 27   
 import org.apache.geronimo.ews.ws4j2ee.utils.Utils;
 28   
 
 29   
 import javax.wsdl.Operation;
 30   
 import javax.wsdl.Part;
 31   
 import javax.wsdl.Port;
 32   
 import javax.xml.namespace.QName;
 33   
 import java.io.InputStream;
 34   
 import java.io.Writer;
 35   
 import java.util.Iterator;
 36   
 import java.util.Map;
 37   
 
 38   
 /**
 39   
  * This class wrap the JAXRPCMapper and only expose a interface to
 40   
  * the rest of the WS4j2ee.
 41   
  *
 42   
  * @author Srinath Perera(hemapani@opensource.lk)
 43   
  * @see org.apache.geronimo.ews.ws4j2ee.context.JaxRpcMapperContext
 44   
  */
 45   
 public class JaxRpcMapperImpl implements JaxRpcMapperContext {
 46   
     private JaxRpcMapper jaxrpcmapper;
 47   
     private J2eeEmitter j2ee;
 48   
 
 49  17
     public JaxRpcMapperImpl(JaxRpcMapper jaxrpcmapper, J2eeEmitter j2ee) {
 50  17
         this.jaxrpcmapper = jaxrpcmapper;
 51  17
         this.j2ee = j2ee;
 52   
     }
 53   
 
 54   
     /**
 55   
      * @param messageQName
 56   
      * @return
 57   
      */
 58  2
     public String getExceptionType(QName messageQName) {
 59  2
         String exceptionName = jaxrpcmapper.getExceptionType(messageQName);
 60  2
         if (exceptionName == null) {
 61  0
             exceptionName = j2ee.getJavaName(messageQName);
 62  0
             if (exceptionName == null)
 63  0
                 throw new UnrecoverableGenerationFault("the exception name in a SEI OP can not be null" +
 64   
                         "possibly be a bug check the WSDL2Java data extraction");
 65   
         }
 66  2
         return exceptionName;
 67   
     }
 68   
 
 69   
     /**
 70   
      * @param bEntry
 71   
      * @param operation
 72   
      * @return
 73   
      */
 74  41
     public String getJavaMethodName(BindingEntry bEntry, Operation operation) {
 75  41
         String opName = jaxrpcmapper.getJavaMethodName(bEntry, operation);
 76  41
         if (opName == null)
 77  0
             opName = operation.getName();
 78  41
         if (opName == null)
 79  0
             throw new UnrecoverableGenerationFault("the method name in a SEI OP can not be null" +
 80   
                     "possibly be a bug check the WSDL2Java data extraction");
 81  41
         return Utils.firstCharacterToLowerCase(opName);
 82   
     }
 83   
 
 84   
     /**
 85   
      * @param bEntry
 86   
      * @param operation
 87   
      * @param position
 88   
      * @return
 89   
      */
 90  55
     public String getJavaMethodParamType(BindingEntry bEntry,
 91   
                                          Operation operation,
 92   
                                          int position, QName parmType) {
 93  55
         String type = jaxrpcmapper.getJavaMethodParamType(bEntry, operation, position);
 94  55
         if (type == null) {
 95  54
             type = j2ee.getJavaName(parmType);
 96  54
             if (type == null)
 97  0
                 throw new UnrecoverableGenerationFault("the parm type name in a SEI OP can not be null" +
 98   
                         "possibly be a bug check the WSDL2Java data extraction");
 99   
         }
 100  55
         return type;
 101   
     }
 102   
 
 103   
     /**
 104   
      * @param bEntry
 105   
      * @param operation
 106   
      * @return
 107   
      */
 108  41
     public String getJavaMethodReturnType(BindingEntry bEntry,
 109   
                                           Operation operation) {
 110  41
         String returnType = jaxrpcmapper.getJavaMethodReturnType(bEntry, operation);
 111  41
         if (returnType == null) {
 112  5
             Map parts = operation.getOutput().getMessage().getParts();
 113  5
             if (parts != null) {
 114  5
                 Iterator returnlist = parts.values().iterator();
 115  5
                 if (returnlist.hasNext()) {
 116  0
                     Part part = (Part) returnlist.next();
 117  0
                     returnType = jaxrpcmapper.getJavaType(part.getTypeName());
 118  0
                     if (returnType == null)
 119  0
                         returnType = j2ee.getJavaName(part.getTypeName());
 120   
                 }
 121   
             }
 122   
         }
 123  41
         return returnType;
 124   
         // fixed inside 
 125   
         // return Utils.jni2javaName(returnType);
 126   
     }
 127   
 
 128   
     /**
 129   
      * @param typeQName
 130   
      * @return
 131   
      */
 132  2
     public String getJavaType(QName typeQName) {
 133  2
         String type = jaxrpcmapper.getJavaType(typeQName);
 134  2
         if (type == null)
 135  0
             type = j2ee.getJavaName(typeQName);
 136  2
         if (type == null)
 137  0
             throw new UnrecoverableGenerationFault("the type name can" +
 138   
                     " not be null possibly be a bug check the WSDL2Java data extraction");
 139  2
         return type;
 140   
     }
 141   
 
 142   
     /**
 143   
      * @param port
 144   
      * @return
 145   
      */
 146  0
     public String getPortName(Port port) {
 147  0
         String portName = jaxrpcmapper.getPortName(port);
 148  0
         if (portName == null) {
 149  0
             portName = port.getName();
 150  0
             if (portName == null)
 151  0
                 throw new UnrecoverableGenerationFault("the portName can" +
 152   
                         " not be null, possibly be a bug check the WSDL2Java data extraction");
 153   
         }
 154  0
         return portName;
 155   
     }
 156   
 
 157   
     /**
 158   
      * @param ptEntry
 159   
      * @param bEntry
 160   
      * @return
 161   
      */
 162  12
     public String getServiceEndpointInterfaceName(PortTypeEntry ptEntry,
 163   
                                                   BindingEntry bEntry) {
 164  12
         String seiName = jaxrpcmapper.getServiceEndpointInterfaceName(ptEntry, bEntry);
 165  12
         if (seiName == null) {
 166  0
             seiName = ptEntry.getName();
 167  0
             if (seiName == null)
 168  0
                 throw new UnrecoverableGenerationFault("the seiName can" +
 169   
                         " not be null, possibly be a bug check the WSDL2Java data extraction");
 170   
         }
 171  12
         return seiName;
 172   
     }
 173   
 
 174   
     /**
 175   
      * @param entry
 176   
      * @return
 177   
      */
 178  1
     public String getServiceInterfaceName(ServiceEntry entry) {
 179  1
         String serviceInterface = jaxrpcmapper.getServiceInterfaceName(entry);
 180  1
         if (serviceInterface == null) {
 181  0
             serviceInterface = entry.getName();
 182  0
             if (serviceInterface == null)
 183  0
                 throw new UnrecoverableGenerationFault("the serviceInterface can" +
 184   
                         " not be null, possibly be a bug check the WSDL2Java data extraction");
 185   
         }
 186  1
         return serviceInterface;
 187   
     }
 188   
 
 189   
     /**
 190   
      * @param path
 191   
      */
 192  0
     public void loadMappingFromDir(String path) throws GenerationFault {
 193  0
         jaxrpcmapper.loadMappingFromDir(path);
 194   
     }
 195   
 
 196   
     /**
 197   
      * @param is
 198   
      */
 199  0
     public void loadMappingFromInputStream(InputStream is) throws GenerationFault {
 200  0
         jaxrpcmapper.loadMappingFromInputStream(is);
 201   
     }
 202   
 
 203   
     /* (non-Javadoc)
 204   
      * @see org.apache.geronimo.ews.ws4j2ee.context.JaxRpcMapperContext#serialize()
 205   
      */
 206  0
     public void serialize(Writer out) {
 207  0
         throw new UnsupportedOperationException("when the wsdl is avalibe serialization not reqired");
 208   
     }
 209   
 
 210   
     /* (non-Javadoc)
 211   
      * @see org.apache.geronimo.ews.ws4j2ee.context.JaxRpcMapperContext#getPackageMappingClassName(int)
 212   
      */
 213  0
     public String getPackageMappingClassName(int index) {
 214  0
         return jaxrpcmapper.getPackageMappingClassName(index);
 215   
     }
 216   
 
 217  0
     public int getPackageMappingCount() {
 218  0
         return jaxrpcmapper.getPackageMappingCount();
 219   
     }
 220   
 
 221  0
     public String getPackageMappingURI(int index) {
 222  0
         return jaxrpcmapper.getPackageMappingURI(index);
 223   
     }
 224   
 
 225   
 }
 226